
# 设置编译器
CC := nvcc

#export NCCL_INSTALL_PATH=/home/twc/nvcc/nvcc_analysis_v2.18.6
CFLAGS = -I/usr/include -L/usr/lib/x86_64-linux-gnu/ -I$(NCCL_INSTALL_PATH)/include -L$(NCCL_INSTALL_PATH)/lib -lnccl

# 设置生成的目标文件
current_dir_name := $(notdir $(shell pwd))
TARGET := $(current_dir_name).elf

# 获取所有的.c文件
SRCS := $(wildcard *.cu)

# 获取所有的.h文件
DEPS := $(wildcard *.h)

# 将.c文件编译成.o文件
OBJS := $(SRCS:.cu=.o)

# 编译规则
$(TARGET): $(OBJS)
	$(CC) -o $@ $(OBJS) $(CFLAGS)
# 依赖规则
%.o: %.cu $(DEPS)
	$(CC) -c $< -o $@ $(CFLAGS)

# 清理规则
clean:
	rm -f $(TARGET) $(OBJS) *.o
